<template>
    <div class="slider">
        <el-carousel indicator-position="outside">
            <template v-for="item in banners">
                <el-carousel-item>
                    <a :href="item.url">
                        <img :src="item.img">
                    </a>
                </el-carousel-item>
            </template>
        </el-carousel>
    </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
    computed: {
        ...mapGetters([
            'banners'
        ])
    },
    beforeRouteEnter(to, from, next) {
        next(vm => {
            // 通过 `vm` 访问组件实例
            console.log(vm.$store + "-----------");
        })
    },
    // watch: {
    //     $route() {
    //         this.$store.dispatch('getBannerList')
    //     }
    // },
    methods: {
    },
    data() {
        return {

        }
    }
}
</script>

<style lang="less">
.slider {
    width: 1336px;
    margin: 0 auto;
}
</style>